<#include "ftls/spring.ftl"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Pragma" content="no-cache"></meta>
<meta http-equiv="Cache-Control" content="no-cache"></meta>
<meta http-equiv="Expires" content="0"></meta>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><@message "title"/></title>
<link rel="stylesheet" type="text/css" href="static/plugins/jquery-easyui-theme/default/easyui.css">
<link rel="stylesheet" type="text/css" href="static/plugins/jquery-easyui-theme/icon.css">
<script type="text/javascript" src="static/plugins/jquery/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="static/plugins/jquery-easyui-1.3.6/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/jmax/js/common.js"></script>
<link rel="shortcut icon" href="static/jmax/images/favicon.png">
</head>
<body style="text-align: center;">
	<div id="loginWin" class="easyui-window" title='<@message "title"/>登录' style="width: 350px; height: 188px; padding: 5px;" minimizable="false" closable="false"
		maximizable="false" resizable="false" collapsible="false">
		<div class="easyui-layout" fit="true">
			<div region="center" border="false"
				style="padding: 5px; background: #fff; border: 1px solid #ccc;">
				<form id="loginForm" method="post">
					<div style="padding: 5px 0;">
						<label for="login">帐号:</label> 
						<input type="text" name="loginName" placeholder="LoginName" style="width: 260px;" value="root"></input>
					</div>
					<div style="padding: 5px 0;">
						<label for="password">密码:</label> 
						<input type="password" placeholder="Password" name="password" style="width: 260px;" value="root"></input>
					</div>
					<input type="hidden" id="remember" name="isRemember" value="false"/>
					<div style="padding: 5px 0; text-align: center; color: red;" id="showMsg"></div>
				</form>
			</div>
			<div region="south" border="false"
				style="text-align: right; padding: 5px 0;">
				<a class="easyui-linkbutton" iconCls="icon-ok"
					href="javascript:void(0)" onclick="login()">登录</a> <a
					class="easyui-linkbutton" iconCls="icon-cancel"
					href="javascript:void(0)" onclick="cleardata()">重置</a>
			</div>
		</div>
	</div>
	<a href="portal.action?index" target="_blank">进入jmax论坛</a>
	<h3 style="color: red;">为了演示，初始化数据请不要删除或移除！</h3>
	<script type="text/javascript">
	document.onkeydown = function(e) {
		var event = e || window.event;
		var code = event.keyCode || event.which || event.charCode;
		if (code == 13) {
			login();
		}
	}
	
	$(function() {
		$("input[name='loginName']").focus();
		//发送访问统计
		$.post("pageView.action?pageViewCount",{formPage:"LOGINPAGE"},function(result){
		    console.log('统计返回：'+result);
		});
	});
	
	function cleardata() {
		$('#loginForm').form('clear');
	}
	
	function login() {
		if ($("input[name='loginName']").val() == "") {
			showMsg("帐号不能为空，请输入");
			$("input[name='loginName']").focus();
			return;
		} 
		if($("input[name='password']").val() == "") {
			showMsg("密码不能为空，请输入");
			$("input[name='password']").focus();
			return;
		}
		
		//ajax异步提交  
		$.ajax({
			type : "POST",
			url : "authLogin.action?login",
			data : $("#loginForm").serialize(), //序列化               
			error : function(request) { // 设置表单提交出错 
				printLog(request);
				showMsg('登陆错误'); //登录错误提示信息
			},
			success : function(data) {
				var d = $.parseJSON(data);
				if (d.success) {
					window.location.href='main.do?main';
				} else {
					showMsg(d.msg)
				}
				
			}
		});
	}
	</script>
	
	
	
	
</body>
</html>